* In-text numbers in subsection VI.D
* 29 Oct 2021

clear all
set more off

cap log close		
log using "$output_s/counterfactuals.log", replace 

* Get original misallocation

import excel "$output_s/Structural_Results_at_ss_assets_minus_land_of_rich.xlsx", sheet("Sheet1") firstrow clear 

quietly: su misallocation, d
local misallocation_orig = r(sum)

* Reducing A by 50%

import delimited "$intermediate\counterfactuals\optimal_case_by_hh3_with_A_reduced_at_ss_assets_minus_land_of_rich.csv", clear

gen occup = ceil(case_opt/2) //Quick way to separate cases

label define occupation 1 "Mixing" 2 "Livestock Rearing Only" 3 "Wage Work Only" 4 "No Work"
label values occup occupation

tab occup

quietly: su misallocation_sim, d
disp 1 - r(sum)/`misallocation_orig'

* Doubling w

import delimited "$intermediate\counterfactuals\optimal_case_by_hh3_with_w_doubled_at_ss_assets_minus_land_of_rich.csv", clear

gen occup = ceil(case_opt/2) //Quick way to separate cases

label define occupation 1 "Mixing" 2 "Livestock Rearing Only" 3 "Wage Work Only" 4 "No Work"
label values occup occupation

tab occup

quietly: su misallocation_sim, d
disp 1 - r(sum)/`misallocation_orig'

* Reducing psi_h by 50%

import delimited "$intermediate\counterfactuals\optimal_case_by_hh3_psih_reduced_at_ss_assets_minus_land_of_rich.csv", clear

gen occup = ceil(case_opt/2) //Quick way to separate cases

label define occupation 1 "Mixing" 2 "Livestock Rearing Only" 3 "Wage Work Only" 4 "No Work"
label values occup occupation

tab occup

quietly: su misallocation, d
disp 1 - r(sum)/`misallocation_orig'

log close 
